package io.ganguo.chat.route.server.dto;

import io.ganguo.chat.core.transport.DataBuffer;

/**
 * Created by hasee on 2016-03-28.
 */
public class JsonDto extends baseDTO {
    //转化为JSON格式然后序列化
    private String JsonData;

    public String getJsonData() {
        return JsonData;
    }

    public void setJsonData(String jsonData) {
        JsonData = jsonData;
    }

    public JsonDto() {
    }

    public JsonDto(String JsonData) {
        this.JsonData = JsonData;
    }

    @Override
    public DataBuffer encode(short version) {
        DataBuffer buffer = new DataBuffer();
        buffer.writeString(JsonData);
        return buffer;
    }

    @Override
    public void decode(DataBuffer buffer, short version) {
        JsonData = buffer.readString();
    }

    @Override
    public String toString() {
        return "JsonDto{" +
                "JsonData=" + JsonData + '\'' +
                '}';
    }


}
